package com.changpei.search;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * 开启定时任务
 * @author weibiao
 */
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}, scanBasePackages = {"com.changpei.common.exception", "com.changpei.common.config", "com.changpei.common.cache", "com.changpei.search"})
@EnableEurekaClient
@EnableFeignClients(basePackages = "com.changpei.core.feign")
@EnableElasticsearchRepositories(basePackages = "com.changpei.search.dao")
@EnableScheduling
public class SearchApplication {
    public static void main(String[] args) {
        // Springboot整合Elasticsearch 在项目启动前设置一下的属性，防止报错
        // 解决netty冲突后初始化client时还会抛出异常
        // java.lang.IllegalStateException: availableProcessors is already set to [4], rejecting [4]
        System.setProperty("es.set.netty.runtime.available.processors", "false");
        SpringApplication.run(SearchApplication.class, args);
    }
}
